package com.simplegovern.dict.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.simpleframe.persistence.hibernate.Page;
import com.simpleframe.persistence.hibernate.Searcher;
import com.simplegovern.dict.Dict;
import com.simplegovern.dict.DictItem;
import com.simplegovern.dict.dao.DictItemDAO;

public class DictItemService {

	@Autowired
	private DictItemDAO dictItemDAO;
	
	public DictItem getById(long id){
		return dictItemDAO.findById(id);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void deletes(Long[] ids){
		dictItemDAO.deletes(ids);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void create(DictItem dictItem){
		dictItemDAO.save(dictItem);
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public void update(DictItem dictItem){
		dictItemDAO.update(dictItem);
	}
	
	//以上自动生成
	
	public Page getPage(Searcher searcher, Dict dict){
		return dictItemDAO.getPage(searcher, dict);
	}
	
}
